package com.itheima.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.domain.Intervention;
import com.itheima.domain.QueryPageBean;
import com.itheima.service.InterventionService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author M
 */
@Controller
@ResponseBody
@RequestMapping("/Intervention")
public class InterventionController {
    @Reference
    private InterventionService interventionService;
    @RequestMapping("/getIntervention")
    public List<Intervention> getIntervention(){
        List<Intervention> list = interventionService.findAll();
        return list;
    }
    @RequestMapping("/getInterventionById")
    public Intervention getInterventionById(int id){
        return interventionService.getById(id);
    }
    @RequestMapping("/edit")
    public void edit(@RequestBody Intervention intervention){
        System.out.println(intervention);
        interventionService.update(intervention);
    }

    @RequestMapping("/intervention_Add")
    public void intervention_Add(@RequestBody Intervention intervention){
        interventionService.intervention_Add(intervention);
    }
    @RequestMapping("/findPage")
    public void findPage( QueryPageBean queryPageBean){

    }



}